<html lang="en"><!-- InstanceBegin template="/Templates/base.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<link rel="stylesheet" href="http://www.accessify.com/_css/accessify_16jan2010.css">
<!-- InstanceBeginEditable name="head" -->
<style type="text/css" media="screen">
	#txtRaw, #txtGenerated {display:block;width:99%;height:7em;}
	#vn {display:block;padding-left:25px;}
</style><!-- InstanceEndEditable -->
</head>
<body>
<div id="content">
	<a name="skip-content" id="skip-content" href="#skip-content" class="skip-dest"></a>
    
        <div id="maincontent">
        <h1><!-- InstanceBeginEditable name="main_heading" -->HTML to JavaScript Convertor<!-- InstanceEndEditable --></h1>
        <!-- InstanceBeginEditable name="main_page_content" -->
		<p>The HTML to JavaScript convertor takes your markup and converts it to a series of document.write() statements that you can use in a block of JavaScript.</p>

		<form id="html2js" name="html2js">

		<div id="step1">
		<label for="txtRaw">Enter the HTML here</label>
		<textarea id="txtRaw" name="txtRaw" cols="60" rows="10"></textarea>
		<fieldset>
		<legend>Output options</legend>
		<div><input type="radio" name="outputOptions" id="outputOpt1"> <label for="outputOpt1">Output as series of document.write statements</label></div>
		<div><input type="radio" name="outputOptions" id="outputOpt2"> <label for="outputOpt2">Output as document.write statements wrapped in a function</label></div>
		<div><input type="radio" name="outputOptions" id="outputOpt3"> <label for="outputOpt3">Build up a string variable that you can use later</label> <span id="vn"><label><strong>Type variable name here:</strong></label> <input type="text" id="varname" value="strVar"></span></div>
		</fieldset>
		<div class="buttonstrip"><input type="button" id="cmdGenerate" value="Convert to JavaScript syntax &rarr;"></div>

		</div>

		<div id="step2">
		<label for="txtGenerated">Generated JavaScript version</label>
		<textarea id="txtGenerated" name="txtGenerated" cols="60" rows="10"></textarea>
		</div>

		</form>

		<div class="helper" id="htmljavascript-help">
			<p>When using this tool, it will convert and escape all those troublesome single quote, double quote issues that always throw you curve balls when creating strings in JavaScript. The last option - to build up a string using a variable name - is most likely to be the best use for this tool. But hey, that's your choice. Enjoy.</p>
		</div>

		

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript" src="http://www.accessify.com/_scripts/common_30dec2009.js"></script>

<!-- InstanceBeginEditable name="page_specific_scripts" -->
<script type="text/javascript">
$(document).ready(function(){$("#vn").hide();$("#outputOpt1").click();$("#varname").keyup(function(){$("#cmdGenerate").click();});$("input[name=outputOptions]").change(function(){if ($(this).attr("id")=="outputOpt3") {$("#vn").show();}else {$("#vn").hide();}$("#cmdGenerate").click();});$("#cmdGenerate").click(function(){var r = $("#txtRaw").val();var strVar = $("#varname").val();if (strVar=="") {strVar="strVar";}var g = "";var arr = r.split("\n");var opt = $("input[name='outputOptions']:checked").attr("id");if (opt=="outputOpt2") {g += "<script type=\"text\/javascript\">\n";g += "function writeHTMLasJS(){\n";};if (opt=="outputOpt3") {g += "var " + strVar + "=\"\";\n";};for (i=0;i<arr.length;i++){var l = "";if ((opt=="outputOpt1")||(opt=="outputOpt2")) {l += "document.write(\"";};if (opt=="outputOpt3") {l += strVar + " += \"";};l += arr[i].replace(/\"/g, "\\\"").replace(/\//g, "\\/");if ((opt=="outputOpt1")||(opt=="outputOpt2")) {l += "\");";};if (opt=="outputOpt3") {l += "\";";};l += "\n";g += l;}if (opt=="outputOpt2") {g += "}\n";g += "<\/script>";g += "\n\n<!--\nnow place this function call at whatever point\nit needs to write the markup on to the page: -->\n\n";g += "<script type=\"text\/javascript\">\n";g += "writeHTMLasJS();\n";g += "<\/script>";};$("#txtGenerated").val(g);});});</script>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>